package com.example.service.impl;

import com.example.dao.ArticleDao;
import com.example.pojo.Article;
import com.example.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import javax.persistence.EntityManager;

@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    private ArticleDao articleDao;

    @Override
    public Page<Article> getPage(Integer currentPage) {
        PageRequest pageRequest = PageRequest.of(currentPage, 1);
        return articleDao.findAll(pageRequest);
    }

}
